package com.chen.jwtbase.system.controller;

import com.chen.jwtbase.system.entity.User;
import com.chen.jwtbase.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName UserController
 * @Description
 * @Author Mr-CHEN
 * @Date 2019/9/29 0029 10:07
 * @Version V1.0
 **/

@RestController
@RequestMapping("/api")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/users")
    public ResponseEntity<Page<User>> getAllUser(@RequestParam(value = "pageNum",defaultValue = "0") int pageNum,@RequestParam(value = "pageSize", defaultValue = "10") int pageSize){
        Page<User> allUser = userService.getAllUser(pageNum,pageSize);
        return ResponseEntity.ok(allUser);
    }

    @GetMapping("/user/{id}")
    public ResponseEntity<User> getUser(@PathVariable(name = "id") int id){
        return ResponseEntity.ok().build();
    }

}